package com.hspjava.Math;

public class MathMethod {
    public static void main(String[] args) {
        int abs = Math.abs(-10);
        System.out.println(abs);


        double pow = Math.pow(3, 2);
        System.out.println(pow);//3* 3

        double ceil = Math.ceil(15.23432);
        System.out.println(ceil);

        double floor = Math.floor(-3.4324);
        System.out.println(floor);

        long round = Math.round(33.654);
        System.out.println(round);

        double sqrt = Math.sqrt(9);
        System.out.println(sqrt);




        //7.球random随机数
        //思考：写出获取a-b之间的一个随机整数 
        for (int i = 0; i < 100; i++) {
            //Math.random() * 6  => 0 到6 小数
            //2 + Math.random() * 6 => 2, 到8 => [2, 7](整数);
            System.out.println((int) (2 + Math.random() * (7 - 2 + 1)));
        }


    }
}
